<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>mcconf/mcconf_outrunner2.h Source File</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="../../vesc.jpg"/></td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="../../index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="../../pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="../../modules.html"><span>Modules</span></a></li>
      <li><a href="../../annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="../../files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="../../search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="../../files.html"><span>File&#160;List</span></a></li>
      <li><a href="../../globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="../../dir_3264ec38fa05fd1d2b8dd770ad3c56d4.html">mcconf</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">mcconf_outrunner2.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="../../d4/dc7/mcconf__outrunner2_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">    Copyright 2012-2014 Benjamin Vedder benjamin@vedder.se</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">    This program is free software: you can redistribute it and/or modify</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment">    it under the terms of the GNU General Public License as published by</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment">    the Free Software Foundation, either version 3 of the License, or</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment">    (at your option) any later version.</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment">    This program is distributed in the hope that it will be useful,</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment">    but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment">    GNU General Public License for more details.</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment">    You should have received a copy of the GNU General Public License</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment">    along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment">    */</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> * mcconf_outrunner2.h</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> * A configuration for my scorpion 225kv outrunner.</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment"> *  Created on: 14 apr 2014</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment"> *      Author: benjamin</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#ifndef MCCONF_OUTRUNNER2_H_</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#define MCCONF_OUTRUNNER2_H_</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="comment"> * Parameters</span></div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#adf473b7b77c34afb7b3a61cacb7b5ca4">   33</a></span>&#160;<span class="preprocessor">#define MCPWM_CURRENT_MAX               60.0    // Current limit in Amperes (Upper)</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#a2496db1f49843b7361673c65d0c32690">   34</a></span>&#160;<span class="preprocessor">#define MCPWM_CURRENT_MIN               -60.0   // Current limit in Amperes (Lower)</span></div>
<div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#a95f563bcedd8fd85c0fb014d356577d6">   35</a></span>&#160;<span class="preprocessor">#define MCPWM_IN_CURRENT_MAX            60.0    // Input current limit in Amperes (Upper)</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#a587de4e767cef50ee3fab4e642a1f415">   36</a></span>&#160;<span class="preprocessor">#define MCPWM_IN_CURRENT_MIN            -20.0   // Input current limit in Amperes (Lower)</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#af5e260436dd949257cfc95788a471410">   37</a></span>&#160;<span class="preprocessor">#define MCPWM_MAX_ABS_CURRENT           130.0   // The maximum absolute current above which a fault is generated</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#a1159a79710492a543942589d0b81ffae">   38</a></span>&#160;<span class="preprocessor">#define MCPWM_SLOW_ABS_OVERCURRENT      1       // Use the filtered (and hence slower) current for the overcurrent fault detection</span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="comment">// Sensorless settings</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#a53dbfbbc47310e4fccca19a955ec11bd">   41</a></span>&#160;<span class="preprocessor">#define MCPWM_SENSOR_MODE               SENSOR_MODE_SENSORLESS // Sensor mode</span></div>
<div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#a2388d3f08037af860e84c51ddbb08cf2">   42</a></span>&#160;<span class="preprocessor">#define MCPWM_MIN_RPM                   150     // Auto-commutate below this RPM</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#a4b091f980da07604812e38760e7815dc">   43</a></span>&#160;<span class="preprocessor">#define MCPWM_CYCLE_INT_LIMIT_MIN_RPM   1100.0  // Minimum RPM to calculate the BEMF coupling from</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#afda072f655bdfd0580f0fbc7b1db724c">   44</a></span>&#160;<span class="preprocessor">#define MCPWM_CYCLE_INT_LIMIT           62.0    // Flux integrator limit 0 ERPM</span></div>
<div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#ab1d5653ec379033303eccb112de22822">   45</a></span>&#160;<span class="preprocessor">#define MCPWM_CYCLE_INT_LIMIT_HIGH_FAC  0.8     // Flux integrator limit percentage at MCPWM_CYCLE_INT_START_RPM_BR ERPM</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#adf414513bd228c1541d60204b0c4cb7b">   46</a></span>&#160;<span class="preprocessor">#define MCPWM_BEMF_INPUT_COUPLING_K     600.0   // Input voltage to bemf coupling constant</span></div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="comment">// Speed PID parameters</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#aaed305430942f4458e29e68bb6f88d8c">   49</a></span>&#160;<span class="preprocessor">#define MCPWM_PID_KP                    0.0001  // Proportional gain</span></div>
<div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#ad4c05e8aaea3b430675fad175f4be53f">   50</a></span>&#160;<span class="preprocessor">#define MCPWM_PID_KI                    0.002   // Integral gain</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#a88bf23b40ed4a577262ffa885d2d226b">   51</a></span>&#160;<span class="preprocessor">#define MCPWM_PID_KD                    0.0     // Derivative gain</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#aa9647bf337b4df9b7a725aaa5070a2e2">   52</a></span>&#160;<span class="preprocessor">#define MCPWM_PID_MIN_RPM               900.0   // Minimum allowed RPM</span></div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="comment">// Position PID parameters</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#a93aaae89fe7caf71066375e5d49163e4">   55</a></span>&#160;<span class="preprocessor">#define MCPWM_P_PID_KP                  0.0001  // Proportional gain</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#a065e136b15d8eb05cb80af32199a0d12">   56</a></span>&#160;<span class="preprocessor">#define MCPWM_P_PID_KI                  0.002   // Integral gain</span></div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#a97d0b7993c8c8c55777c553f7ddd20e4">   57</a></span>&#160;<span class="preprocessor">#define MCPWM_P_PID_KD                  0.0     // Derivative gain</span></div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;<span class="comment">// Current control parameters</span></div>
<div class="line"><a name="l00060"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#af3777d19ceb3cefffee51724d619d590">   60</a></span>&#160;<span class="preprocessor">#define MCPWM_CURRENT_CONTROL_GAIN      0.0046  // Current controller error gain</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="../../d4/dc7/mcconf__outrunner2_8h.html#a6a5e0119f98c040e6641e1d9050b55d5">   61</a></span>&#160;<span class="preprocessor">#define MCPWM_CURRENT_CONTROL_MIN       1.0     // Minimum allowed current</span></div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* MCCONF_OUTRUNNER2_H_ */</span><span class="preprocessor"></span></div>
</div><!-- fragment --></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="https://github.com/joshdellay" target="_new">Josh Dellay</a>